<template>
  <div class="app-container">
    <el-row :gutter="20">
      <splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme">
        <pane size="16">
          <el-col>
            <div class="head-container">
              <el-input v-model="deptName" placeholder="请输入客户所在地区" clearable size="small" prefix-icon="el-icon-search"
                style="margin-bottom: 20px" />
            </div>
            <div class="head-container">
              <el-tree :data="parentAccountName" :props="defaultProps" auto-expand-parent default-expand-all
                :expand-on-click-node="true" :filter-node-method="filterNode" ref="tree" highlight-current
                @node-click="handleNodeClick" />
            </div>
          </el-col>
        </pane>
        <pane size="84">
          <el-col>
            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
              <el-form-item label="代号" prop="id">
                <el-input v-model="queryParams.id" placeholder="请输入代号" clearable @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="名称" prop="name">
                <el-input v-model="queryParams.name" placeholder="名称" clearable @keyup.enter.native="handleQuery" />
              </el-form-item>
                <el-form-item label="客户类别" prop="type">
                       <el-select v-model="queryParams.type" placeholder="请选择客户类别">
                         <el-option label="代理部A区客户" value="代理部A区客户"></el-option>
                         <el-option label="代理部B区客户" value="代理部B区客户"></el-option>
                         <el-option label="英国代理客户" value="英国代理客户"></el-option>
                          <el-option label="日本代理客户" value="日本代理客户"></el-option>
                        </el-select>
                     </el-form-item>
              <!-- <el-form-item label="客户类别" prop="type">
                <el-input v-model="queryParams.type" placeholder="请输入客户类别" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item> -->
              <el-form-item label="所属地区" prop="areas">
                <el-input v-model="queryParams.areas" placeholder="请输入客户所属地区" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item>
                          
                  <el-form-item label="属性" prop="attribute">
                       <el-select v-model="queryParams.attribute" placeholder="请选择客户属性">
                         <el-option label="内销" value="内销"></el-option>
                         <el-option label="外销" value="外销"></el-option>
                        </el-select>
                     </el-form-item>
              <!-- <el-form-item label="属性" prop="attribute">
                <el-input v-model="queryParams.attribute" placeholder="请输入客户属性" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item> -->
              <el-form-item label="负责人" prop="response">
                <el-input v-model="queryParams.response" placeholder="请输入负责人" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="联系人" prop="contacts">
                <el-input v-model="queryParams.contacts" placeholder="请输入联系人" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="手机" prop="mobilePhone">
                <el-input v-model="queryParams.mobilePhone" placeholder="请输入手机" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item>
              <el-form-item label="email" prop="email">
                <el-input v-model="queryParams.email" placeholder="请输入email" clearable
                  @keyup.enter.native="handleQuery" />
              </el-form-item>

              <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
              </el-form-item>
            </el-form>

            <el-row :gutter="10" class="mb8">
              <el-col :span="1.5">
                <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
              </el-col>
              <!-- <el-col :span="1.5">
                <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
                  @click="handleUpdate">修改</el-button>
              </el-col> -->
              <el-col :span="1.5">
                <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
                  @click="handleDelete">删除</el-button>
              </el-col>
              <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
              </el-col>
              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
            </el-row>

            <el-table :row-class-name="rowClassName" :data="detailedData" v-loading="loading" @selection-change="handleSelectionChange">
              <el-table-column type="selection" width="55" align="center" />
              <el-table-column prop="id" align="center" label="代号" />
              <el-table-column prop="name" align="center" label="名称" />
              <el-table-column prop="type" align="center" label="客户类别" />
              <el-table-column prop="areas" align="center" label="所属地区" />
              <el-table-column prop="attribute" align="center" label="属性" />
              <el-table-column prop="address" align="center" label="地址" />
              <el-table-column prop="response" align="center" label="负责人" />
              <el-table-column prop="contacts" align="center" label="联系人" />
              <el-table-column prop="mobilePhone" align="center" label="手机" />
              <el-table-column prop="phone" align="center" label="电话" />
              <el-table-column prop="fax" align="center" label="传真" />
              <el-table-column prop="bank" align="center" label="开户行" />
              <el-table-column prop="account" align="center" label="银行账号" />
              <el-table-column prop="taxId" align="center" label="税号" />
              <el-table-column prop="postalCode" align="center" label="邮编" />
              <el-table-column prop="email" align="center" label="email" />
              <el-table-column prop="netAddress" align="center" label="网址" />
              <el-table-column prop="transport" align="center" label="运输方式" />
              <el-table-column prop="transportTime" align="center" label="运输时间" />
              <el-table-column prop="PaymentCycle" align="center" label="收款周期" />
              <el-table-column prop="SettleTime" align="center" label="月结时间" />
              <el-table-column prop="reputation" align="center" label="信誉额度" />
              <el-table-column prop="salesman" align="center" label="业务员" />
              <el-table-column prop="invoCustomer" align="center" label="开票客户" />
              <el-table-column prop="source" align="center" label="客户来源" />
              <el-table-column prop="inputman" align="center" label="录入人" />
              <el-table-column prop="remark" align="center" label="备注" />

              <el-table-column label="操作" align="center" width="150px" fixed="right">
                <template slot-scope="scope">
                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
                  <el-button size="mini" type="text" icon="el-icon-delete"
                    @click="handleDelete(scope.row)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>

            <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
              @pagination="getList" />

          </el-col>
        </pane>
      </splitpanes>
    </el-row>
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row>
          <!-- <el-col :span="8">
            <el-form-item label="类别" prop="类别">
              <el-select v-model="form.类别" style="width: 240px;" :disabled="isEdit">
                <el-option value="原料" label="原料" />
                <el-option value="辅料" label="辅料" />
                <el-option value="半成品" label="半成品" />
                <el-option value="成品" label="成品" />
                <el-option value="设备" label="设备" />
                <el-option value="模具" label="模具" />
                <el-option value="其他" label="其他" />
              </el-select>
            </el-form-item>
          </el-col>-->
          <el-col :span="8">
            <el-form-item label="代号" prop="id">
              <el-input v-model="form.id" placeholder="请输入代号" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入客户名称" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户类别" prop="type">
               <el-select v-model="form.type" placeholder="请选择客户类别">
                   <el-option label="代理部A区客户" value="代理部A区客户"></el-option>
                   <el-option label="代理部B区客户" value="代理部B区客户"></el-option>
                   <el-option label="英国代理客户" value="英国代理客户"></el-option>
                  <el-option label="日本代理客户" value="日本代理客户"></el-option>
               </el-select>
             </el-form-item>
          </el-col>

        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="客户所属地区" prop="areas">
              <el-input v-model="form.areas" placeholder="请输入客户所属地区" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户属性" prop="attribute">
              <el-select v-model="form.attribute" placeholder="请选择客户属性" style="width: 240px;" :disabled="isEdit">
                <el-option value="内销" label="内销" />
                <el-option value="外销" label="外销" />

              </el-select>
              <!-- <el-input v-model="form.attribute" placeholder=" /> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户地址" prop="address">
              <el-input v-model="form.address" placeholder="请输入客户地址" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="客户负责人" prop="response">
              <el-input v-model="form.response" placeholder="请输入客户负责人" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户联系人" prop="contacts">
              <el-input v-model="form.contacts" placeholder="请输入客户联系人" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户手机号" prop="mobilePhone">
              <el-input v-model="form.mobilePhone" placeholder="请输入客户手机号" />
              <!-- <el-select v-model="form.是否需要货位" style="width: 240px;" :disabled="isEdit">
                <el-option value="是" label="是" />
                <el-option value="否" label="否" />
              </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="客户电话" prop="phone">
              <el-input v-model="form.phone" placeholder="请输入客户电话" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户传真" prop="fax">
              <el-input v-model="form.fax" placeholder="请输入客户传真号" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开户行" prop="bank">
              <el-input v-model="form.bank" placeholder="请输入开户行" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="银行账号" prop="account">
              <el-input v-model="form.account" placeholder="请输入客户银行账号" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="税号" prop="taxId">
              <el-input v-model="form.taxId" placeholder="请输入税号" />
              <!-- <el-select v-model="form.是否管制" style="width: 240px;" :disabled="isEdit">
                <el-option value="是" label="是" />
                <el-option value="否" label="否" />
              </el-select> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="邮编" prop="postalCode">
              <el-input v-model="form.postalCode" placeholder="请输入客户邮编" />
              <!-- <el-select v-model="form.来源" style="width: 240px;" :disabled="isEdit">
                <el-option value="自制" label="自制" />
                <el-option value="购买" label="购买" />
              </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="email" prop="email">
              <el-input v-model="form.email" placeholder="请输入客户电子邮箱" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="客户网址" prop="netAddress">
              <el-input v-model="form.netAddress" placeholder="请输入客户网址 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="运输方式" prop="transport">
              <el-input v-model="form.transport" placeholder="请输入运输方式" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="运输时间" prop="transportTime">
              <el-input v-model="form.transportTime" placeholder="请输入运输时间" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="收款周期" prop="PaymentCycle">
              <el-input v-model="form.PaymentCycle" placeholder="请输入收款周期 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="月结时间" prop="SettleTime">
              <el-input v-model="form.SettleTime" placeholder="请输入月结时间" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="信誉额度" prop="reputation">
              <el-input v-model="form.reputation" placeholder="请输入客户信誉额度" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="业务员" prop="salesman">
              <el-input v-model="form.salesman" placeholder="请输入业务员名称 " />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="开票客户" prop="invoCustomer">
              <el-input v-model="form.invoCustomer" placeholder="请输入开票客户名称" />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="8">
            <el-form-item label="客户来源" prop="source">
              <el-input v-model="form.source" placeholder="请输入客户来源" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="录入人" prop="inputman">
              <el-input v-model="form.inputman" placeholder="请输入录入人" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" placeholder="请输入备注" />
              <!-- <el-select v-model="form.采购方式" style="width: 240px;" :disabled="isEdit">
                <el-option value="按单采购" label="按单采购" />
                <el-option value="批量采购" label="批量采购" />
              </el-select> -->
            </el-form-item>
          </el-col>
        </el-row>

        

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { Splitpanes, Pane } from "splitpanes";
import "splitpanes/dist/splitpanes.css";
export default {
  components: { Splitpanes, Pane },
  data() {
    return {
      // 标题
      title: null,
      // 总条数
      total: 0,
      // 打开弹出框
      open: false,
      // 表格
      form: {},
      // 校验
      rules: {},

      detailedData: [{
        id: 'C10015',
        name: '陸晶国际有限公司',
        type: '外销部客户',
        areas: '东南亚',
        attribute: '外销',
        address: '上海市延安西路726号华敏翰尊国际26栋A座',
        contacts: 'Chris Huar',
        response: '',
        mobilePhone: '',
        transport: '',
        transportTime: '',
        phone: '86 21- 52379595-323',
        PaymentCycle: '',
        SettleTime: '',
        reputation: '',
        salesman: '王佳云',
        invoCustomer: '陸晶国际有限公司',
        source: '',
        fax: '86 21- 52380781',
        bank: '',
        account: '',
        taxId: '',
        netAddress: '',
        email: '',
        postalCode: '',
        inputman: '叶万娟',
        remark: ''
      }, {
        id: "YY002",
        name: 'Smart Vave Development Limited(China)',
        type: '外销部客户',
        areas: '欧洲',
        attribute: '内销',
        address: '宁波市勤州区高桥镇芦港村望春路1510弄98号',
        contacts: 'Daisy',
        response: '',
        mobilePhone: '+86 159905',
        transport: '',
        transportTime: '',
        phone: '',
        PaymentCycle: '',
        SettleTime: '',
        reputation: '',
        salesman: '杨莹',
        invoCustomer: 'Smart Vave Development Limited(China)',
        source: '',
        fax: '',
        bank: '',
        account: '',
        taxId: '',
        netAddress: '',
        email: '',
        postalCode: '',
        inputman: '叶万娟',
        remark: ''
      }, {
        id: "C10025",
        name: 'AL-FAIDA WORLD MODERN EST.',
        type: '外销部客户',
        areas: '中东',
        attribute: '外销',
        address: 'HINDAWIAH BIN SHIHDOON CENTER 4TH FLOOR P.O.BOX 16470 JEDDAH 21464 SAUD',
        contacts: 'IYAD SAAD',
        response: '',
        mobilePhone: '00966 2 6495585 / 6495565',
        transport: '汽运',
        transportTime: '',
        phone: '',
        PaymentCycle: '',
        SettleTime: '',
        reputation: '',
        salesman: '叶慧',
        invoCustomer: 'AL-FAIDA WORLD MODERN EST.',
        source: '',
        fax: '',
        bank: '',
        account: '',
        taxId: '',
        netAddress: '',
        email: 'import@faidawor',
        postalCode: '',
        inputman: '叶慧',
        remark: ''
      }],

      parentAccountName: [{
        label: '客户所在地区列表',
        children: [{
          label: '国内',
          children: [{
            label: '山东'
          }, {
            label: '辽宁'
          }, {
            label: '吉林'
          }, {
            label: '大连'
          }, {
            label: '鞍山'
          }, {
            label: '本溪'
          }]
        }, {
          label: '国外',
          children: [{
            label: '日本'
          }, {
            label: '英国'
          }, {
            label: '美国'
          }, {
            label: '泰国'
          }]

        }]
      }],
            
      defaultProps: {
        children: 'children',
        label: 'label'
      },
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      showSearch: true,
      single: false,
      multiple: false,
      tableData: [],
      tableData1: [{
        label: '原材料',
        children: [{
          编号: '0103010025',
          代号: 'HZ-BF3064037',
          品名: 'BF3064037花纸',
          类别: '花纸',
          主单位: '张',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',

        }, {
          编号: '0103010026',
          代号: 'HZ-BF3064038',
          品名: 'BF3064038花纸',
          类别: '花纸',
          主单位: '张',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
        }, {
          编号: '0103010027',
          代号: 'HZ-BF3064039',
          品名: 'BF3064039花纸',
          类别: '花纸',
          主单位: '张',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
        }]
      }, {
        label: '辅料类',
        children: [{
          编号: '02032896',
          代号: 'HZ-A101',
          品名: 'BF325085胶带',
          类别: '辅料',
          主单位: '个',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
          包装数: '1000',
          // 来源: '自制',
        }, {
          编号: '02032897',
          代号: 'HZ-A102',
          品名: 'BF325086胶带',
          类别: '辅料',
          主单位: '个',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
          包装数: '1000',
        }, {
          编号: '02032898',
          代号: 'HZ-A103',
          品名: 'BF325087胶带',
          类别: '辅料',
          主单位: '个',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
          包装数: '1000',
        }]
      }, {
        label: '半成品类',
        children: [{
          编号: '03032896',
          代号: 'HZ-A101',
          品名: '汤碗',
          类别: '半成品',
          主单位: '个',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
          包装数: '1000',
          // 来源: '自制',
        }, {
          编号: '03032897',
          代号: 'HZ-A102',
          品名: '汤碗',
          类别: '半成品',
          主单位: '个',
          副单位: '米',
          转换率: '1:1',
          货位: 'A1',
          是否需要货位: '是',
          ABC编码: 'A101',
          批号: '20210101',
          条形码: '123456789012',
          来源: '自制',
          是否管制: '否',
          重量单位: '克',
          单位重量: '1000',
          体积单位: '立方米',
          单位体积: '1',
          保质天数: '30',
          安全库存: '1000',
          最小库存: '0',
          最大库存: '100000',
          最少库存金额: '0',
          最大库存金额: '100000000',
          税率: '0.13',
          采购方式: '按单采购',
          采购提前期: '1',
          生产提前期: '1',
          价格: '100',
          状态: '正在使用',
          包装数: '1000',
        }]
      },
      {
        label: '成品类'
      },
      {
        label: '其他类'
      },
      {
        label: '设备类'
      },
      {
        label: '模具类'
      }],
      loading: false,
      ids: [],
      isShow1: false,
      isShow2: false,
      isShow3: false,
      isShow4: false,
      isShow5: false,
      isShow6: false,
    }
  },
  // mounted() {
  //   this.handleNodeClick(this.parentAccountName[0].children[0])
  // },
  // methods: {
  //   filterNode(value, data) {
  //     if (!value) return true;
  //     return data.label.indexOf(value) !== -1;
  //   },
  //   handleNodeClick(data) {
  //     if (data.label === '原材料') {
  //       this.tableData = this.tableData1[0].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = false;
  //       this.isShow4 = false;
  //       this.isShow5 = false;
  //       this.isShow6 = false;
  //     } else if (data.label === '辅料类') {
  //       this.tableData = this.tableData1[1].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = false;
  //       this.isShow4 = true;
  //       this.isShow5 = false;
  //       this.isShow6 = false;
  //     } else if (data.label === '半成品类') {
  //       this.tableData = this.tableData1[2].children;
  //       this.isShow1 = false;
  //       this.isShow2 = true;
  //       this.isShow3 = false;
  //       this.isShow4 = false;
  //       this.isShow5 = false;
  //       this.isShow6 = false;
  //     } else if (data.label === '成品类') {
  //       this.tableData = this.tableData1[3].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = true;
  //       this.isShow4 = false;
  //       this.isShow5 = false;
  //       this.isShow6 = false;
  //     } else if (data.label === '其他类') {
  //       this.tableData = this.tableData1[4].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = false;
  //       this.isShow4 = true;
  //       this.isShow5 = false;
  //       this.isShow6 = false;
  //     } else if (data.label === '设备类') {
  //       this.tableData = this.tableData1[5].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = false;
  //       this.isShow4 = false;
  //       this.isShow5 = true;
  //       this.isShow6 = false;
  //     } else if (data.label === '模具类') {
  //       this.tableData = this.tableData1[6].children;
  //       this.isShow1 = false;
  //       this.isShow2 = false;
  //       this.isShow3 = false;
  //       this.isShow4 = false;
  //       this.isShow5 = false;
  //       this.isShow6 = true;
  //     }
  //   },
  //   submitForm() {
  //     this.open = false;
  //   },
  //   cancel() { this.open = false; },
  //   handleQuery() {
  //     this.loading = false;
  //   },
  //   resetQuery() {
  //   },
  //   handleAdd() {
  //     this.title = '新增原材料'
  //     this.open = true;
  //     this.isEdit = false;
  //   },
  //   handleUpdate(row) {
  //     this.title = '编辑原材料'
  //     this.open = true;
  //     this.isEdit = false;
  //     this.form = row;
  //   },
  //   handleDelete() { },
  //   handleExport() { },
  //   handleSelectionChange(selection) {
  //     this.ids = selection.map((item) => item.userId);
  //     this.single = selection.length !== 1;
  //     this.multiple = !selection.length;
  //   },
  // },
  mounted() {
    this.handleNodeClick(this.parentAccountName[0].children[0])
  },
  methods: {
    
      //显示高亮
        rowClassName({ row }) {
          return row.id === this.id ? 'selected-row' : ''; // 判断是否选中
        },
    filterNode(value, data) {
      if (!value) return true;
      return data.label.indexOf(value) !== -1;
    },
    handleNodeClick(data) {
      if (data.label === '原材料') {
        this.tableData = this.tableData1[0].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = false;
        this.isShow4 = false;
        this.isShow5 = false;
        this.isShow6 = false;
      } else if (data.label === '辅料类') {
        this.tableData = this.tableData1[1].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = false;
        this.isShow4 = true;
        this.isShow5 = false;
        this.isShow6 = false;
      } else if (data.label === '半成品类') {
        this.tableData = this.tableData1[2].children;
        this.isShow1 = false;
        this.isShow2 = true;
        this.isShow3 = false;
        this.isShow4 = false;
        this.isShow5 = false;
        this.isShow6 = false;
      } else if (data.label === '成品类') {
        this.tableData = this.tableData1[3].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = true;
        this.isShow4 = false;
        this.isShow5 = false;
        this.isShow6 = false;
      } else if (data.label === '其他类') {
        this.tableData = this.tableData1[4].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = false;
        this.isShow4 = true;
        this.isShow5 = false;
        this.isShow6 = false;
      } else if (data.label === '设备类') {
        this.tableData = this.tableData1[5].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = false;
        this.isShow4 = false;
        this.isShow5 = true;
        this.isShow6 = false;
      } else if (data.label === '模具类') {
        this.tableData = this.tableData1[6].children;
        this.isShow1 = false;
        this.isShow2 = false;
        this.isShow3 = false;
        this.isShow4 = false;
        this.isShow5 = false;
        this.isShow6 = true;
      }
    },
    submitForm() {
      this.open = false;
    },
    cancel() { this.open = false; },
    handleQuery() {
      this.loading = false;
    },
    resetQuery() {
    },
    handleAdd() {
      this.title = '新增客户信息'
      this.open = true;
      this.isEdit = false;
    },
    handleUpdate(row) {
      this.title = '编辑客户信息'
      this.open = true;
      this.isEdit = false;
      this.form = row;
    },
    handleDelete() { },
    handleExport() { },
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.userId);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
  },

}
</script>

<style>
.selected-row {
  background-color: yellow !important;
  /* 选中行的背景颜色 */
}
</style>